package com.ruoyi.system.service.impl;

import com.ruoyi.system.domain.JobWaitCountDayExamine;
import com.ruoyi.system.mapper.JobWaitCountDayExamineMapper;
import com.ruoyi.system.service.JobWaitCountDayExamineService;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 待汇总日审核表(JobWaitCountDayExamine)表服务实现类
 *
 * @author makejava
 * @since 2022-11-23 09:20:10
 */
@Service("jobWaitCountDayExamineService")
public class JobWaitCountDayExamineServiceImpl implements JobWaitCountDayExamineService {
    @Resource
    private JobWaitCountDayExamineMapper jobWaitCountDayExamineDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public JobWaitCountDayExamine queryById(Integer id) {
        return this.jobWaitCountDayExamineDao.queryById(id);
    }

    /**
     * 分页查询
     *
     * @param jobWaitCountDayExamine 筛选条件
     * @param pageRequest            分页对象
     * @return 查询结果
     */
    @Override
    public Page<JobWaitCountDayExamine> queryByPage(JobWaitCountDayExamine jobWaitCountDayExamine, PageRequest pageRequest) {
        long total = this.jobWaitCountDayExamineDao.count(jobWaitCountDayExamine);
        return new PageImpl<>(this.jobWaitCountDayExamineDao.queryAllByLimit(jobWaitCountDayExamine, pageRequest), pageRequest, total);
    }

    @Override
    public List<JobWaitCountDayExamine> queryAll(JobWaitCountDayExamine jobWaitCountDayExamine) {
        return jobWaitCountDayExamineDao.queryAll(jobWaitCountDayExamine);
    }

    /**
     * 新增数据
     *
     * @param jobWaitCountDayExamine 实例对象
     * @return 实例对象
     */
    @Override
    public JobWaitCountDayExamine insert(JobWaitCountDayExamine jobWaitCountDayExamine) {
        this.jobWaitCountDayExamineDao.insert(jobWaitCountDayExamine);
        return jobWaitCountDayExamine;
    }

    /**
     * 修改数据
     *
     * @param jobWaitCountDayExamine 实例对象
     * @return 实例对象
     */
    @Override
    public JobWaitCountDayExamine update(JobWaitCountDayExamine jobWaitCountDayExamine) {
        this.jobWaitCountDayExamineDao.update(jobWaitCountDayExamine);
        return this.queryById(jobWaitCountDayExamine.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.jobWaitCountDayExamineDao.deleteById(id) > 0;
    }
}
